# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dirhunt
pkgver=329.a5ea20d
pkgrel=5
pkgdesc='Find web directories without bruteforce.'
groups=('blackarch' 'blackarch-webapp' 'blackarch-scanner')
arch=('any')
url='https://github.com/hahwul/dirhunt'
license=('MIT')
depends=('python' 'python-click' 'python-requests' 'python-requests-mock'
         'python-humanize' 'python-colorama' 'python-beautifulsoup4'
         'python-proxy-db' 'python-google' 'python-legacy-cgi' 'python-six')
makedepends=('git' 'python-setuptools')
source=("git+https://github.com/Nekmo/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|click<8|click|g' requirements.txt

  find . -type f -iname '*.py' -exec sed -i \
    's|from click import get_terminal_size|from shutil import get_terminal_size|g' {} \;
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" *.rst
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

